package cn.leyaber.hrm.service.impl;

import cn.leyaber.hrm.domain.Activity;
import cn.leyaber.hrm.mapper.ActivityMapper;
import cn.leyaber.hrm.redusutils.constants.CommentConstant;
import cn.leyaber.hrm.service.IActivityService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ma.rui.kai
 * @since 2020-12-04
 */
@Service
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements IActivityService {
   @Autowired
   private  ActivityMapper activityMapper;
    @Override
    public void batchDelete(List<Long> dis) {
      System.out.println(dis);
      activityMapper.batchDelete(dis);
    }

    @Override
    public void Modify_status(Activity activity) {
         if (activity.getState().equals(CommentConstant.COMMENT_DISABLE)) {
             activity.setState(CommentConstant.COMMENT_ENABLE);
             activityMapper.updateById(activity);
         }else{
             activity.setState(CommentConstant.COMMENT_ENABLE);
             activityMapper.updateById(activity);
         }
    }
}
